package com.cakin.javademo;

import java.util.Calendar;
import java.util.regex.Pattern;

/**
 * @ClassName: Canlendartest
 * @Description: Canlendar测试
 * @Date: 2020/6/17
 * @Author: cakin
 */
public class Calendartest {
    public static void main(String[] args) {
        // 1 怎样获得一个Canlenar对象
        Calendar instance = Calendar.getInstance();
        // 2 怎样设置
        // set
        instance.set(2020,6,18);
        System.out.println(instance);
        instance.set(Calendar.YEAR,2019);
        instance.set(Calendar.MONTH,6);
        instance.set(Calendar.DATE,17);
        System.out.println(instance);
        // add
        instance.add(Calendar.YEAR,2);
        instance.add(Calendar.DATE,-10);
        System.out.println(instance);
        // get
        System.out.println("======================================");
        System.out.println(instance.get(Calendar.YEAR));
        System.out.println(instance.get(Calendar.MONTH));
        System.out.println(instance.get(Calendar.DATE));
        System.out.println(instance.get(Calendar.HOUR));
        System.out.println(instance.get(Calendar.MINUTE));
        System.out.println(instance.get(Calendar.SECOND));
        System.out.println("======================================");
        String content = "I am noob " +
                "from runoob.com.";

        String pattern = "runoob";

        boolean isMatch = Pattern.matches(pattern, content);
        System.out.println("字符串中是否包含了 'runoob' 子字符串? " + isMatch);


    }
}
